<?php
/**
 * Created by PhpStorm.
 * 商品单位
 * User: caicm
 * Date: 2017/6/19
 * Time: 14:11
 */

namespace WMApi\Model;


use Think\Model;

class WmUnitModel extends Model {

    /**
     * 获取商品单位列表
     * Created By caicm
     * @return mixed
     */
    public function get_unit_list(){

        $where = array(
            'is_show' => 1,
            'is_del' => 0
        );

        return $this->field('unit_id,unit_name')->where($where)->order('sort')->select();

    }

    /**
     * 获取商品单位详情
     * Created By caicm
     * @param int $unit_id
     * @return mixed
     */
    public function find_unit_info($unit_id=0){

        $where = array(
            'is_show' => 1,
            'is_del' => 0,
            'unit_id' => $unit_id
        );

        return $this->field('unit_id,unit_name')->where($where)->find();

    }
}